package org.moonlight.jvm.instructions.comparisons.ifacmp;

import org.moonlight.jvm.instructions.base.BranchInstruction;
import org.moonlight.jvm.rtda.exclusive.Frame;
import org.moonlight.jvm.rtda.exclusive.OperandStack;

/**
 * IF_ACMPNE: 将 操作数栈栈顶 的两个 引用型变量 弹出，根据引用是否相同进行跳转
 *
 * @author Moonlight
 * @createTime 2023/8/23 8:45
 **/
public class IfACmpNe extends BranchInstruction {

    @Override
    public void execute(Frame frame) {
        OperandStack stack = frame.getOperandStack();
        Object a = stack.popRef();
        Object b = stack.popRef();

        if (a != b) {
            branch(frame);
        }
    }

}
